#!/bin/bash

if [ $(id -u) = 0 ]
then
   echo "This script must not be run as root" 1>&2
   exit
fi

ROOT_PATH=$(cd $(dirname $0) && pwd);

echo ### FFQueue ###

if [ -r "$ROOT_PATH/ffqueue/FFQueue" ]
then

mkdir -p $HOME/FFQueue
#mkdir -p /tmp/FFQueue

#cp -f $HOME/FFQueue/*.cfg /tmp/FFQueue
cp -f $ROOT_PATH/ffqueue/* $HOME/FFQueue
#cp -f /tmp/FFQueue/*.cfg $HOME/FFQueue

#rm -f -r /tmp/FFQueue

chmod a+x $HOME/FFQueue/FFQueue

sh -c "echo '[Desktop Entry]
Type=Application
Name=FFQueue
Exec=$HOME/FFQueue/FFQueue
Icon=$HOME/FFQueue/Logo.png
Terminal=false
' > $HOME/Desktop/FFQueue.desktop"

chmod a+x $HOME/Desktop/FFQueue.desktop


fi
